﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default4 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    protected void btnInsert_Click(object sender, EventArgs e)
    {
        SqlDataSource1.InsertParameters["Username"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("txtUsername")).Text;
        SqlDataSource1.InsertParameters["Fullname"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("txtFullname")).Text;
        SqlDataSource1.InsertParameters["Email"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("txtEmail")).Text;
        SqlDataSource1.InsertParameters["Phone"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("txtPhone")).Text;
        SqlDataSource1.InsertParameters["Gender"].DefaultValue = ((DropDownList)GridView1.FooterRow.FindControl("ddlGender")).SelectedValue;
        SqlDataSource1.Insert();

    }
    /*
     * Nói chung Gridview Control sử dụng ADO.NET
     */
}